package com.fmy.springbootsecurity.config.service;

import com.fmy.security.service.login.CustAuthentication;
import com.fmy.security.service.login.authenticator.CustAuthenticator;
import org.springframework.stereotype.Service;

/**
 * @author Mr.fmy
 * @version 1.0.0
 * @ClassName CustUsernameAuthention
 * @Description TODO 自定义用户名密码登录方式
 * @createTime 2019/9/10 11:33
 */
@Service
public class CustUsernameAuthention implements CustAuthenticator<UserDetailsVo> {

    @Override
    public UserDetailsVo authenticate(CustAuthentication authentication) {
        return new UserDetailsVo(authentication.getUsername());
    }

    @Override
    public void prepare(CustAuthentication authentication) {

    }

    @Override
    public boolean support(CustAuthentication authentication) {
        return !"app".equals(authentication.getAuthType());
    }
}
